package com.demo217_存在重复元素1;
/**
 * 通过!!!!
 */

import java.util.TreeSet;

public class Solution {
    public boolean containsDuplicate(int[] nums) {
        TreeSet<Integer> set = new TreeSet<>();
        for (int i = 0; i < nums.length; i++) {
            boolean add = set.add(nums[i]);
            if (!add){
                return true;
            }
        }
        return false;
    }
}
